package smartcampus.scjava.service;

import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.stereotype.Service;
import smartcampus.scjava.POJO.DO.Xinzitongji;
import smartcampus.scjava.POJO.DO.Xuesheng;
import smartcampus.scjava.mapper.XinzitongjiMapper;

import javax.annotation.Resource;
import java.util.Collection;
import java.util.List;

@Service
public class XinzitongjiService {
    @Resource
    private XinzitongjiMapper xinzitongjiMapper;


    public Collection<Object> findAllXinzi() {
        return xinzitongjiMapper.findAllXinzi();
    }

    public Collection<Object> findAllNum() {
        return xinzitongjiMapper.findAllNum();
    }

    public PageInfo<Xinzitongji> selectPage(Integer pageNum , Integer pageSize, Xinzitongji xinzitongji) {
        PageHelper.startPage(pageNum,pageSize);  //设置分页参数
        List<Xinzitongji> xinzitongjiListList = xinzitongjiMapper.selectAll(xinzitongji);
        return PageInfo.of(xinzitongjiListList);

    }
    public void add(Xinzitongji xinzitongji) {
        xinzitongjiMapper.insert(xinzitongji);
    }
    public void deleteById(Integer id) {
        xinzitongjiMapper.deleteById(id);
    }
    public void updateById(Xinzitongji xinzitongji) {
        xinzitongjiMapper.updateById(xinzitongji);
    }

    public List<String> selectAllXuehao() {
        return xinzitongjiMapper.selectAllXuehao();
    }
}
